package org.gp.demo.timer.util;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.ee.servlet.QuartzInitializerServlet;
import org.quartz.impl.StdSchedulerFactory;

public class ScheduleUtil {
	public static Scheduler getScheduler(ServletContext ctx)
			throws SchedulerException {

		StdSchedulerFactory factory = (StdSchedulerFactory) ctx
				.getAttribute(QuartzInitializerServlet.QUARTZ_FACTORY_KEY);

		return factory.getScheduler();
	}

}
